package cn.edu.cdu.health.service.impl;

import cn.edu.cdu.health.entity.Appointment;
import cn.edu.cdu.health.entity.AppointmentPageDto;
import cn.edu.cdu.health.mapper.AppointmentMapper;
import cn.edu.cdu.health.service.AppointmentService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

@Service
public class AppointmentServiceImpl extends ServiceImpl<AppointmentMapper, Appointment> implements AppointmentService {

    @Override
    public Page<Appointment> pageQuery(AppointmentPageDto dto) {
        Page<Appointment> page = new Page<>(dto.getPageNum(), dto.getPageSize());
        return baseMapper.pageQuery(page, dto);
    }

    @Override
    public Appointment getById(Long id) {
        return baseMapper.getById(id);
    }

    @Override
    public boolean updateStatus(Long id, Integer status) {
        return baseMapper.updateStatus(id, status) > 0;
    }
}